<?php
namespace Home\Controller;
use Avos\AVQuery;
use Think\Controller;
class IndexController extends Controller {
    function index()
    {
        $sponsor = new AVQuery('ECSponsor');
        $sponsor->setKey('name,logo,objectId');
        $sponsor->whereExists('objectId');
        $sponsor->setLimit(8);
        $sponsorInfo = $sponsor->find();
        $this->assign('sponsor',$sponsorInfo->results);

        $activity = new AVQuery('ECActivity');
        $activity->setKey('thumb,name,beginDate,endDate,address,objectId');
        $activity->whereExists('objectId');
        //$activity->whereNear('beginDate',time());
        $activity->orderByDescending('beginDate');
        $activityInfo = $activity->find();
        $this->assign('activity',$activityInfo->results);
        $this->display();
    }

    function demo()
    {
        $this->display();
    }
}